var sensorAction = {

  setLight: function(lightness) {
    var lightRange = [30, 130];
    var opacity = 1 - Math.abs((lightness - lightRange[0]) / lightRange[1]);
    $('.light .mask').css("opacity", opacity);
  },

  setUltrasonic: function(distance) {

  },

  speaked: false,
  setLinefollow: function(value) {
    if(value == 0) {
      if(!this.speaked) {
        textToSpeech('大家好，我是小智');
        this.speaked = true;
        setTimeout(function() {
          $('.ball').show();
        }, 3000);
      }
    }

    if(value == 2) {
      $('.ball').hide();
      // 进入灯泡模式,关闭巡线传感器
      MBlockly.Sensors.closeSensor('LINEFOLLOW');
      $('#container').hide();
      MBlockly.Sensors.openSensor('LIGHTSENSOR');
    }
  },

  setGyro: function(valueObject) {

  },
};